package com.situ.mall.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.situ.mall.admin.pojo.query.RoleQuery;
import com.situ.mall.admin.service.IAdminRoleService;
import com.situ.mall.pojo.entity.admin.AdminRole;
import com.situ.mall.pojo.entity.admin.Role;
import com.situ.mall.admin.mapper.RoleMapper;
import com.situ.mall.admin.service.IRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Gao
 * @since 2024-11-29
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {
    @Autowired
    private RoleMapper roleMapper;
    @Autowired
    private IAdminRoleService adminRoleService;

    @Override
    public IPage<Role> list(RoleQuery roleQuery) {
        QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("name", roleQuery.getName());
        queryWrapper.like("code", roleQuery.getCode());
        IPage<Role> page = new Page<>(roleQuery.getPage(), roleQuery.getLimit());
        return roleMapper.selectPage(page, queryWrapper);
    }
}
